Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

package.json: add "types" to "exports" #90

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

jkonowitch
Copy link
Contributor

According to the Typescript Docs, TS expects to find a "types" property in the package.json "exports" declaration

When moduleResolution is set to node16, nodenext, or bundler, and resolvePackageJsonExports is not disabled, TypeScript follows Node.js’s package.json "exports" spec when resolving from a package directory triggered by a bare specifier node_modules package lookup.

Because libsql-js does not, I receive this error:

Could not find a declaration file for module 'libsql'. '/node_modules/.pnpm/[email protected]/node_modules/libsql/index.js' implicitly has an 'any' type.
  There are types at '/node_modules/libsql/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'libsql' library may need to update its package.json or typings.ts

I have tested this locally, and this resolves the issue.

NOTE: I did not implement a fix for the promise based API, as I was not sure what you all wanted to do in terms of extending the types/index.d.ts.

@jkonowitch
Copy link
Contributor Author

@penberg @notrab - I think this PR is ready to be merged. Any feedback?

Copy link
Member

@notrab notrab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙏🏻

lgtm. cc @giovannibenussi

@giovannibenussi
Copy link
Contributor

Looks good to me too!

@penberg penberg merged commit d07e9e2 into tursodatabase:main Apr 2, 2024
8 checks passed
@jkonowitch jkonowitch deleted the package-json-exports branch April 2, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants